<template>
  <div class="zy-cardcell">
    <div v-for="(item, index) in data" :key="index">
      <div class="cards-list" v-if="item.length !== 1">
        <div class="img-contant"><img class="bank-type" src="../../assets/img/component/cardWallet.png"></div>
        <div class="name">{{ item[0].cardName }}</div>
        <div class="card-no">{{ item.length }}张</div>
        <img class="jiantou-img" :class="{rotate: show[index] === true}" src="../../assets/img/Fundation/jiantou@2x.png" @click="shouwCardsListInfo(index)">
        <div class="card-detail" v-if="show[index] === true">
          <div class="list-detail" v-for="(list,index) in item" :key="index">
            <img class="bank-type" :src="list.cardType | bankImg">
            <!-- <div class="bank-name">{{ list.cardType | bankType }}</div> -->
            <div class="bank-name">{{ list.cardPulisherName }}</div>
            <div class="crad-info">{{ list.headerNo }}</div>
          </div>
        </div>
      </div>
      <div class="card-list" v-else>
        <div class="img-contant"><img class="bank-type-L" :src="item[0].cardType | bankImg"></div>
        <div class="info">
          <div class="name">{{ item[0].cardName }}</div>
          <!-- <div class="bank-info">{{ item[0].cardType | bankType }} {{ item[0].headerNo }}</div> -->
          <div class="bank-info">{{ item[0].cardPulisherName }} <span class="fot28">{{ item[0].headerNo }}</span></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'zxCardcell',
  props: {
    data: {
      type: Array,
      default () {
        return []
      }
    }
  },
  data () {
    return {
      show: [false]
    }
  },
  filters: {
    bankType (type) {
      if (type === '01') {
        return '中国工商银行'
      } else {
        return '中国建设银行'
      }
    },
    bankImg (type) {
      if (type === '01') {
        return require('../../assets/img/cardBgRed.png')
      } else {
        return require('../../assets/img/cardBgYellow.png')
      }
    }
  },
  methods: {
    shouwCardsListInfo (index) {
      if (this.show[index] === true) {
        this.show = []
        this.show[index] = false
      } else {
        this.show = []
        this.show[index] = true
      }
    }
  }
}
</script>

<style lang="less">
.zy-cardcell{
  .fot28{
    font-size: .28rem;
  }
  .cards-list{
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    background: #fff;
    border: 1px solid #F7F8FA;
    .name{
      font-size: 0.32rem;
      height: 1.2rem;
      width: 5rem;
      line-height: 1.2rem;
    }
    .card-no{
      color: #F28300;
      font-size: 0.32rem;
      height: 1.2rem;
      width: 0.5rem;
      line-height: 1.2rem;
    }
    .jiantou-img{
      height: 0.24rem;
      width: 0.24rem;
      margin: 0.38rem 0.3rem;
      transform: rotate(0deg);
    }
    .rotate{
      transform: rotate(180deg);
    }
    .card-detail{
      width: 100%;
      background: #F7F8FA;
      .list-detail{
        background: url('../../../static/icon/gary-card-bg.svg') no-repeat center center;
        width: 6.94rem;
        height: 0.9rem;
        display: flex;
        margin: .2rem auto;
        border-radius: .15rem .15rem 0 0;
        .bank-name{
          color: #fff;
          font-size: 0.28rem;
          margin: auto 0;
          width: 36%;
        }
        .crad-info{
          color: #fff;
          font-size: 0.32rem;
          padding: 0.28rem 0;
          width: 45%;
          text-align: right;
        }
        .bank-type{
          height: 0.5rem;
          width: 0.5rem;
          border-radius: 50%;
          margin: auto 0.26rem;
        }
      }
    }
  }
  .card-list{
    background: #fff;
    display: flex;
    width: 100%;
    height: 1.2rem;
    border: 1px solid #F7F8FA;
    .img-contant{
      padding: 0.21rem 0.16rem 0.21rem 0.28rem;
      .bank-type-L{
        height: 0.58rem;
        width: 0.58rem;
        border-radius: 50%;
      }
    }
    .info{
      .name{
        font-size: 0.32rem;
        color: #333;
        padding: 0.15rem 0 .02rem;
      }
      .bank-info{
        font-size: 0.24rem;
        color: #9B9B9B;
      }
    }
  }
  .img-contant{
    padding: 0.29rem 0.16rem 0.29rem 0.28rem;
    .bank-type{
      height: 0.42rem;
      width: 0.58rem;
    }
  }
}
</style>
